<!doctype html>

<html>
<head>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<?php
//include_once('../navbar.php');
include_once('../superheader.php');
?>

<a href="../report.php"><id="nav1" name="radio"><label for="nav1">REPORT</label></a>

<script type="text/javascript">
$(function() {$(document).ready( function () {	
	$( "#subset" ).buttonset();
    $( "#datepicker" ).datepicker();
    $( "#datepicker2" ).datepicker();
    $( "#button5" ).button();
    $("#response").html("");
        
		var params =  
		{
			colReq2: "software",
		};

        var data = JSON.stringify(params);
         
         $.ajax({
                    cache: false,
                    type: "json",
                    //url: "http://www.si1entstill.us:8080/phpfunctions/lists/listSoftware.php",
                    url: "/phpfunctions/lists/listSoftware.php",
                    contentType: "application/json",
                    processData: true,
                    data: data,
                    success: function(res, textStatus, jqXHR){
		      var container = $("#response");
			 var table = $("<table border=\"1\">");
			 var head = $("<tr>");
			 //head.append("<th>MongoId</th>");
			 head.append("<th>Name</th>");
			 head.append("<th>Barcode</th>");
			 head.append("<th>Type</th>");
			 head.append("<th>Commission Date</th>");
			 head.append("<th>Decomission Date</th>");
			 head.append("<th>Description</th>");
		 	 table.append(head);

			 for(var key in res.data.messages)
			 {
				var tr = $("<tr>");
				var message = res.data.messages[key];
				var td = $("<td>");
				/*td.html(message['_id']);
				tr.append(td);*/
					
				var td = $("<td>");
				td.html(message.name);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.barcode);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.type);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.comDate);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.decomDate);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.description);
				tr.append(td);
					
				table.append(tr);			
			 }
                         //container.append(JSON.stringify(res['data']));
			container.html(table);
                    },
                    complete: function(XMLHttpRequest, text_status) {

                    }
                  });
});
</script>
</head>

<body>
	<p>herp derp</p>


	<div id="response" style="position: relative; top:0px; left:400px; height:25px">
      Stuff to be replaced.
    </div>
</body>

</html>